/*
 * PNGResource.cpp
 *
 *  Created on: Jul 29, 2013
 *      Author: zapmunk
 */

#include "headerstop.h"

#include "PNGResource.h"

SDL_Surface* PNGResource::getImage() const throw(RESOURCE_ERROR) {
	if (isLoaded()) {
		SDL_RWops* rw = SDL_RWFromConstMem(data, size);
		SDL_Surface* surf = IMG_LoadPNG_RW(rw);
		SDL_FreeRW(rw);
		return surf;
	} else throw ERROR_NOT_LOADED;
}
